<?php
	namespace app\controllers\test_study;
	use yii\web\Controller;
	use app\models\test_study\admin;
	class Model_ruleController extends Controller{
		public function actionIndex(){
			$admin = new admin();
			$data = [
				'data'=>
						[
						'id'=>10,
						'username'=>'',
						'password'=>'sbb'
						]
			];
			$admin->validate();
			$admin->load($data);	
			print_R($admin->getErrors());
		}
		public function actionValidate(){
			$data = [
				'Test' => [
					'username' => 'smister',
					'password' => '123456',
				]
			];
			$test = new \app\models\test_study\admin();
			$test->load($data);
			if(!$test->validate()){
				//获取错误
				var_dump($test->getErrors());
			}

			//var_dump($test);

		}
	}
?>